#!/usr/bin/env python

# -------------------------------
# projects/python/primes/main.py
# Copyright (C) 2009
# Austin Lawless
# -------------------------------

# To run the program
#     python main.py <Primes.in >Primes.out

# To document the program
#     pydoc -w main

# -------
# globals
# -------

successful = False # impossible flag
primes_filled = False # cache filled flag
x = 0 # input: don't change
a = 0 # output
b = 0 # output
c = 0 # output
d = 0 # output
primes = [] # global cahce of primes

# -----------
# InputReader
# -----------

class InputReader (object) :
    def read (self) :
        return raw_input()

# ------------
# OutputWriter
# ------------

class OutputWriter (object) :
    def write (self, *a) :
        for w in a :
            print w,
        print

# -------
# my_read
# -------

def my_read (r) :
    """
    reads an int x
    return true if that succeeds, false otherwise
    """
    global x
    try :
        s = r.read()
    except EOFError :
        return False
    l = s.split()
    x = int(l[0])
    return True

# -----------
# set_a_and_b
# -----------

def set_a_and_b (x) :
    """
    makes x even by subtracting 4 or 5 and sets a = 2 and b = 2,3 respectively and return the leftovers
    """
    global a
    global b
    a = 2
    if (x % 2) == 0: # if x is even, set b = 2 and subtract a and b from x
        b = 2
        x = x - 4
    else: # if x is odd, set b = 3 and subtract a and b from x
        b = 3
        x = x - 5
    assert (((a + b) < 6) and ((a + b) > 3))
    return x

# --------------
# get_two_primes
# --------------

def get_two_primes (x) :
    """
    finds two prime numbers that sum to x
    """
    global c
    global d
    global successful

    if (x == 4):
        c = d = 2
        successful = True
        return
    c = x/2
    if ((c % 2) == 0):
        c -= 1
    while (c > 2):
        if (primes[((c - 1) / 2)]):
            d = x - c
            successful = primes[((d - 1) / 2)]
        if (successful):
            break
        c -= 2
    assert (((c + d) == x) and successful)

# -------
# my_eval
# -------

def my_eval () :
    """
    computes four primes that sum to x
    and stores the result in a, b, c, and d
    """
    global successful
    global primes_filled
    global x
    global a
    global b
    global c
    global d

    if (not primes_filled):
        fill_primes()
        primes_filled = True

    successful = False
    if (x < 8):
        return
    new_x = set_a_and_b(x)
    get_two_primes(new_x)
    assert successful == True
    
# --------
# my_print
# --------

def my_print (w) :
    """
    writes the values of a, b, c, and d
    """
    w.write(a, b, c, d)

# -----------
# fill_primes
# -----------

def fill_primes () :
    """
    fill a cache of primes by bool-markoff from 1 - 4,999,997 (odds only)
    """
    global primes
    while(primes.__len__() <= 4999998):    # fill the list with a bunch of False bools
        primes.append(True)
    primes[0] = False
    iterator = 0
    while (iterator < 4999998):
        if (primes[iterator] == True):
            jump = (2 * iterator) + 1
            inside_iterator = iterator + jump
            while (inside_iterator < 4999998):
                primes[inside_iterator] = False
                inside_iterator += jump
        iterator += 1

# ----
# main
# ----

def main () :
    """
    runs the program
    """
    global successful

    while my_read(InputReader()) :
        my_eval()
        if (successful == True):
            my_print(OutputWriter())
        else:
            print "Impossible."

if __name__ == "__main__" :
    main()

